package com.yj.springbootdesign.simpleFactory;

public class SimpleFactory {


    public Product createProduct(String productName){
        if ("a".equals(productName)){
            return new ConcreteProductA();
        }else if ("b".equals(productName)){
            return new ConcreteProductB();
        }else {
            return null;
        }
    }


    public static void main(String[] args) {
        SimpleFactory simpleFactory = new SimpleFactory();
        Product a = simpleFactory.createProduct("a");
        a.use();
    }
}
